package org.tysite.tyservice.example.validation.annotation;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

/**
 * 运行时，验证属性不能为空，且长度在1~20之间
 * @author tysite
 * @date 2020/3/22 0022 20:36
 */
@Target({ ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = {DemoNameValidator.class})
@Documented
public @interface DemoName {
    
    String message() default "名称的长度必须在1~20之间";
    
    Class<?>[] groups() default {};
    
    Class<? extends Payload>[] payload() default {};
}
